<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message"/>
    
    <h:form id="userForm">

        <rich:panel>
            <f:facet name="header">User</f:facet>
    
            <s:decorate id="nameDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Name</ui:define>
                <h:inputText id="name" required="true"
                             value="#{userHome.instance.name}"/>
            </s:decorate>
            <s:decorate id="passwordDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Enter password</ui:define>
                <h:inputText id="password" required="true"
                             value="#{userHome.instance.password}"/>
            </s:decorate>
            <s:decorate id="passwordConfirmationDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Confirm password</ui:define>
                <h:inputText id="passwordConfirmation" required="true"
                             value="#{userHome.passwordConfirmation}"/>
            </s:decorate>
            <s:decorate id="emailDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Email</ui:define>
                <h:inputText id="email" required="false"
                             value="#{userHome.instance.email}"/>
            </s:decorate>
            
            <div style="clear:both"/>
            
        </rich:panel>

        <div class="actionButtons">
            <h:commandButton id="save" 
                          value="Register" 
                         action="#{userHome.persist}"
                       rendered="#{!userHome.managed}"/>                   
            <h:commandButton id="update" 
                          value="Update" 
                         action="#{userHome.update}"
                       rendered="#{userHome.managed}"/>                  
            <h:commandButton id="delete" 
                          value="Delete" 
                         action="#{userHome.remove}"
                       rendered="#{userHome.managed}"/>
            <s:button id="done" 
                            value="Cancel"
                             view="/home.xhtml"/>
        </div>
        
    </h:form>
    
</ui:define>

</ui:composition>

